import { error } from "cc";
import { getConstructorName } from "../../../platform/utils/TypeUtil";

/**
 * 数据基类
 * 写一个装饰器，拦截所有set方法，localstore存储形式为：
 * fullkey.属性名 = 值得形式
 */
export abstract class BaseData{

    parent:BaseData = null//父类数据

    getDataKey():string{
        throw new error("未实现 getDatakey:"+getConstructorName(this))
    }
    getDataFullKey():string{
        let fullKey = this.getDataKey()
        while(this.parent){
            fullKey = this.parent.getDataKey() + "." + fullKey
            this.parent = this.parent.parent
        }
        return fullKey
    }
    /**判断全路径key是否满足存储得要求，比如 必须是PlayerData开头得才存储 */
    isSave(fullKey:string){
        return true
    }

    loadData(){

    }
}